import { request } from "@/utils/http";
import type {
    userListType,
} from './model/acluserType'
// 获取用户列表
export const reqGetUserList = (page: any,
    limit: any, keyword: any) => {
    return request({
        url: `/admin/acl/user/${page}/${limit}`,
        method: 'get',
        params: keyword
    });
}
// 添加用户
export const reqAddUser = (role: any) => {
    return request({
        url: '/admin/acl/user/save',
        method: 'post',
        data: role
    })
}
// 删除用户
export const reqDeleteById = (id: any) => {
    return request({
        url: `/admin/acl/user/remove/${id}`,
        method: 'delete'
    })
}
// 修改用户
export const reqEditUser = (user: any) => {
    return request({
        url: '/admin/acl/user/update',
        method: 'put',
        data: user
    })
}
// 获取某个用户的所有角色
export const reqGetRoles = (userId: any) => {
    return request({
        url: `/admin/acl/user/toAssign/${userId}`,
        method: 'get'
    })
}
// 给某个用户分配角色
export const reqSaveRoles = (userId: any, roleId: any) => {
    return request({
        url: '/admin/acl/user/doAssign',
        method: 'post',
        params: {
            userId,
            roleId
        }
    })
}